fix: Layer Deployment Permission Issue#2356
Conversation
mndeveci
left a comment
There was a problem hiding this comment.
LGTM, and I tested it on Windows and confirmed it is working.
|
@CoshUS THANK YOU! |
|
still getting same problem even with version 1.9.0 : $ sam --version |
|
@OK-Apps It seems this could be caused by the wrong permission set in the existing resources using the previous version of SAM CLI. Can you try manually deleting those two resources and re-deploy again? |
@CoshUS by "resource" do you mean the lambda functions or the lambda layers ? (or both?) thank you! |
My hunch would be only layers, but try deleting or overriding both.
If your deployment on Mac overrides the existing layer artifact with correct permission bits, then it should be the same as deleting and creating a new one. Thanks! |
|
an update of current state of affairs - everyone in a team has SAM CLI 1.9.0 Layer conversion failed: Some files do not have read permissions; |
|
@CoshUS so puzzled how is it even possible - if things take place at server-side- at AWS, |
|
@CoshUS so what we need to do with those layers? (if we need to do anything with layers to fix this) |
|
A few clarifying questions:
Were the layers created with sam deployed using SAM CLI 1.7.0 or 1.8.0 on Windows?
Are these deployments using the same layers and the same Lambdas?
Lambda is based on Linux which uses unix permission bits. When packaging a layer artifact, Windows does not set permission bits in the zip file which can cause missing permission errors when uploaded and unpacked into Lambda. We changed this behavior in 1.7.0 and forced all file permissions to be 005 when packaged in Windows. This had unintended consequences in deploying layers that can result in If your layers are created manually in Windows, it should have the default 644 permission and not cause read permission issue. |
|
I'm using the lastest release of SAM CLI as 1.10.0 and this issue still remains.
Any ideas? UPDATE: The LayerVersion creation was successful which would fail on 1.8.0, I just can't attach it to functions with Layers configuration, although I'm able attach it on console page, but if you did that, this function later won't able to update with SAM by the same exception. |
|
HI @CoshUS some of our Python layers been manually created on Linux because it had to be done that way - i.e. we cannot just "re-create under WIndows" So what is the way forward from this situation now? Is any version of SAM CLI expected to fix/solve this? - I mean to be able to continue to use SAM CLI from this state of affairs - when got layers that been created manually under Linux because they have to be done under Linux |
|
@OK-Apps |
pls see attached template.zip also, thank you! |
|
I am having the exact same issue with Window machine. SAM deployment works with Linux but not Windows for all the reasons listed. When will this be fixed in the SAM so my development team can SAM deploy from windows machine? |
Issue #, if available:
#2344
Why is this change necessary?
Lambda needs read permission as owner on artifacts.
How does it address the issue?
Changed Windows mocked permission to 755, mimicking Unix system.
Previously, it was changed from default 644 to 005 to give execute permission for go artifacts. Owner and group owner permission bits were removed assuming Lambda itself (not the user executing the code) do not need permission on the artifacts. However, as regression issue #2344 stated, it does require read permission on the Layer artifacts.
There should be no security concern as owner and group owner are set and used by Lambda.
What side effects does this change have?
Owner and group owner permission bits will be set to 7 and 5 respectively.
Did you change a dependency in
requirements/base.txt?If so, did you run
make update-reproducible-reqsChecklist:
make prpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.